﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="产品销售价格收入年报.aspx.cs" Inherits="syc.Sale.Report.产品销售价格收入年报" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
    <script type="text/javascript" language="javascript" src="/common.js"></script>
</head>
<body>
    <form id="form1" runat="server">
     <div>
     
        <div class="hooo">
        <div id="wintop" class="wintop"><span lang="zh-cn"><u>产品销售价格收入年报</u></span></div>
        <asp:Panel ID="Panel1" runat="server" CssClass="panel" Height="36px" Width="972px">
  
        <table>
        <tr id="row2" runat="server">
        <td>
        年份:
        </td>
        <td>
        <asp:DropDownList ID="DList_year" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DList_year_SelectedIndexChanged">
            <asp:ListItem>2009</asp:ListItem>
            <asp:ListItem>2010</asp:ListItem>
            <asp:ListItem>2011</asp:ListItem>
            <asp:ListItem>2012</asp:ListItem>
            <asp:ListItem>2013</asp:ListItem>
            <asp:ListItem>2014</asp:ListItem>
            <asp:ListItem>2015</asp:ListItem>
            <asp:ListItem></asp:ListItem>
        </asp:DropDownList>
        </td>
        </tr>
        </table>
        </asp:Panel>
        <asp:Panel ID="Panel2" runat="server" CssClass="panel2" Width="962px">
        <asp:Label ID="Message" runat="server" Text="·准备就绪" CssClass="prompt" Visible="True"></asp:Label>
        </asp:Panel> 
    
        <h1 style="text-align: center;">
            <%=year %>年产品销售价格收入年报</h1>
        <div align="center">    
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            DataSourceID="SqlDataSource1" style="text-align: center" BorderColor="Black" 
                BorderStyle="Solid" BorderWidth="2px">
                 <RowStyle Height="40px" />
                 <HeaderStyle Height="40px" />                
            <Columns>
                <asp:BoundField DataField="月份" HeaderText="月份" 
                    SortExpression="月份" ReadOnly="True" />
                <asp:BoundField DataField="品名" HeaderText="品名" SortExpression="品名" />
                <asp:BoundField DataField="销售量" HeaderText="销售量" SortExpression="销售量" 
                    ReadOnly="True" />
                <asp:BoundField DataField="累计销售量" HeaderText="累计销售量" ReadOnly="True" 
                    SortExpression="累计销售量" />
                <asp:BoundField DataField="销售金额" HeaderText="销售金额" ReadOnly="True" 
                    SortExpression="销售金额" />
                <asp:BoundField DataField="累计销售金额" HeaderText="累计销售金额" ReadOnly="True" 
                    SortExpression="累计销售金额" />
            </Columns>
        </asp:GridView>
        </div>
    
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
            SelectCommand="SELECT 
MONTH(日期) AS 月份,
dbo.产品.品名, 

/*销售量*/
SUM(数量) AS 销售量, 

/*累计销售量*/
(select 
  SUM(数量) 
from
 dbo.产品销售合同
where
 MONTH(日期)&lt;=MONTH(h.日期)
 and
 (产品ID = h.产品ID)
) AS 累计销售量,

/*销售金额*/
SUM(金额) AS 销售金额,


/*累计销售金额*/
(select 
  SUM(金额) 
from
 dbo.产品销售合同
where
 MONTH(日期)&lt;=MONTH(h.日期)
 and
 (产品ID = h.产品ID)
) AS 累计销售金额

FROM  dbo.产品销售合同 AS h INNER JOIN
      dbo.产品 ON h.产品ID = dbo.产品.ID
WHERE YEAR(日期)=2009
GROUP BY 产品ID,dbo.产品.品名,MONTH(日期)"></asp:SqlDataSource>
    
    </div>
    </form>
</body>
</html>
